package longcaisuyun.longcai.com.yiliubabalongcaisuyun;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import longcaisuyun.longcai.com.suyunbean.CityBean;



/**
 * Created by Administrator on 2016/3/31.
 */
public class CityAdapter  extends BaseAdapter {
    Context  context;
    ViewHolder   viewHolder=null;
    List<CityBean> list;
    public   CityAdapter(Context  context,List<CityBean>list){
        this.context=context;
        this.list=list;
    }
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
//        convertView=View.inflate(context, R.layout.item_citymessage,null);

        if(convertView==null){
            convertView=View.inflate(context, R.layout.item_citymessage,null);
            MyApplication.ScaleScreenHelper.loadView((ViewGroup) convertView);
            viewHolder=new ViewHolder();
            viewHolder.t_city= (TextView) convertView.findViewById(R.id.t_city);
            convertView.setTag(viewHolder);
        }else{
            viewHolder= (ViewHolder) convertView.getTag();
        }

        viewHolder.t_city.setText(list.get(position).getClassname());
        return convertView;
    }
    class   ViewHolder{

      public   TextView   t_city;
    }
}
